import 'package:equatable/equatable.dart';
import 'package:backend.purchases/domain/entities/yookassa_api/yookassa_api_money_amount.dart';

class YookassaApiPaymentRequest extends Equatable {
  const YookassaApiPaymentRequest({
    required this.amount,
    required this.description,
    required this.capture,
    required this.yookassaApiPaymentMethodId,
    required this.paymentMethodData,
    required this.savePaymentMethod,
    required this.confirmationInfo,
    required this.purchaseItemSku,
    required this.userId,
    required this.savedPaymentMethodId,
    required this.paymentToken,
  });

  final YookassaApiMoneyAmount amount;
  final String description;
  final bool capture;
  final String? yookassaApiPaymentMethodId;
  final YookassaApiPaymentRequestPaymentMethodData? paymentMethodData;
  final bool? savePaymentMethod;
  final YookassaApiPaymentRequestConfirmationInfo? confirmationInfo;
  final String purchaseItemSku;
  final String userId;
  final String? savedPaymentMethodId;
  final String? paymentToken;

  @override
  List<Object?> get props {
    return [
      amount,
      description,
      capture,
      yookassaApiPaymentMethodId,
      paymentMethodData,
      savePaymentMethod,
      confirmationInfo,
      purchaseItemSku,
      userId,
      savedPaymentMethodId,
      paymentToken,
    ];
  }
}

class YookassaApiPaymentRequestPaymentMethodData extends Equatable {
  const YookassaApiPaymentRequestPaymentMethodData();

  @override
  List<Object?> get props => [];
}

abstract class YookassaApiPaymentRequestConfirmationInfo {}

class YookassaApiPaymentRequestRedirectConfirmationInfo extends Equatable
    implements YookassaApiPaymentRequestConfirmationInfo {
  const YookassaApiPaymentRequestRedirectConfirmationInfo({
    required this.returnUrl,
    required this.locale,
  });

  final String returnUrl;
  final String locale;

  @override
  List<Object?> get props {
    return [
      returnUrl,
      locale,
    ];
  }
}
